int com_write(char *buffer_variable, int *count_variable)
{
	int mask_variable;
	
	//Error messages
	if(dcb_pointer -> status != DCB_IDLE)
	{
		return ERROR_DEVICE_BUSY;
	}//End error for device busy
	
	if(count_variable == NULL)
	{
		return ERROR_INVALID_COUNT;
	}//End error for invalid count address
	
	if(buffer_variable == NULL)
	{
		return ERROR_INVALID_BUFFER_ADDRESS;
	}//End error for invalid buffer variable address
	
	if(dcb_pointer -> open_variable != DCB_OPEN)
	{
		return ERROR_PORT_NOT_OPEN;
	}//End error for open_variable not being set to OPEN status
	
	
	//Install output buffer into DCB
	dcb_pointer->output_count_variable = count_variable;	//Assign the count variable to the structure variable
	dcb_pointer->status = DCB_WRITING;	//Assign writing status to status variable in structure
	dcb_pointer->output_buffer = buffer_variable;	//Assign buffer variable to structure buffer variable
	dcb_pointer->output_done = 0;	//Assign false to output_done buffer variable
	dcb_pointer->event_flag = EVENT_FLAG_NOT_DONE;	//Assign flag in structure to not done flag
	
	outportb(COM1_BASE, *dcb_pointer->output_buffer);	//write the first character to the com port
	dcb_pointer->output_buffer++;	//Increment the output buffer to go to next character
	dcb_pointer->output_done++;	//Increment output finished to true
	
	//Enable write interrupts
	disable();	
	mask = inportb(COM1_INT_EN);
	mask = mask | 0x02;
	outportb(COM1_INT_EN, mask);
	enable();
	
	return 0;
}//End function

